package com.example.WeChat.Service;

import com.example.WeChat.Data.Redis.RedisService;
import com.example.WeChat.Service.Dao.Chat;
import com.example.WeChat.Utiles.WebSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.websocket.Session;
import java.util.Map;

@Service
public class ChatService implements Chat {
    @Autowired
    private WebSocket webSocket;
    @Autowired
    private RedisService redisService;
    @Override
    public void connectClient(String id) {
    }

    @Override
    public void sendTextMessage(String fromId, String toId, String message) {

    }

    @Override
    public void sendTextMessageToAll(String fromId, String message) {

    }

    @Override
    public boolean isConnected(String id) {
        return false;
    }

    @Override
    public void cacheUnreceivedMessage(String fromId, String toId, String message) {

    }

    @Override
    public String getUnreceivedMessage(String fromId, String toId) {
        return null;
    }

    @Override
    public void deleteUnreceivedMessage(String fromId, String toId) {

    }
    public boolean isOnlineUser(Long id){
        //获取所有在线id
        Map<String, Session> sessionPool = WebSocket.SESSION_POOL;
        //判断id是否在id类表里面
        System.out.println(sessionPool);
        return false;
    }
}
